import { post, del, put, get } from '@/utils/request'
import { obj2FormData } from '@/utils'

const ad = {
  /**
   * @description 新增广告
   * @param data
   */
  insertAd: data => post('/ad', obj2FormData(data)),

  /**
   * @description 删除广告
   * @param id
   */
  deleteAd: id => del(`/ad/${id}`),

  /**
   * @description 修改广告信息
   * @param id, data
   */
  updateAd: (id, data) => put(`/ad/${id}`, obj2FormData(data)),

  /**
   * @description 获取广告列表
   * @param data
   */
  getAd: data => get('/ad', data)
}

export default ad
